package edu.tapestry.iddb.client.services;

import org.apache.tapestry5.ioc.Configuration;
import org.apache.tapestry5.ioc.services.Coercion;
import org.apache.tapestry5.ioc.services.CoercionTuple;

import edu.tapestry.iddb.client.helpers.IMIdentificator;
import edu.tapestry.iddb.client.helpers.PI;

public class AppModule {

	public static void contributeTypeCoercer(
			Configuration<CoercionTuple> configuration) {
		Coercion<String, IMIdentificator> coercion = new Coercion<String, IMIdentificator>() {
			public IMIdentificator coerce(String input) {
				return new IMIdentificator(input);
			}
		};

		configuration.add(new CoercionTuple<String, IMIdentificator>(
				String.class, IMIdentificator.class, coercion));

		Coercion<String, PI> coercion2 = new Coercion<String, PI>() {
			public PI coerce(String input) {
				return new PI(input);
			}
		};

		configuration.add(new CoercionTuple<String, PI>(
				String.class, PI.class, coercion2));

	}
}
